package com.example.s03mybaits;
import com.example.s03mybaits.entity.Commodity;
import com.example.s03mybaits.repository.CommodityMapper;
import com.example.s03mybaits.repository.CommodityMapper2;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.List;

@SpringBootTest
public class CommodityText {
    @Autowired
     CommodityMapper commodityMapper;
     CommodityMapper2 commodityMapper2;

    @Test
    void findComment() {
        List<Commodity> commodity = commodityMapper.findById();
        System.out.println(commodity);
    }

    @Test
    void addCommodity() {
        Commodity commodity = new Commodity(0, "11B", "XJAK003A", "梨", null, null, null, "",  null,null);
        if (commodityMapper2.insertCommodity(commodity) > 0)
            System.out.println("添加成功");
        System.out.println("添加的元素的pid值为" + commodity.getPid());


    }
}



